<template>
    <div class="tatol">
        <goodcar v-for="item in goods" :key="item.id" :data="item" @toid="getid"></goodcar>
    </div>
</template>

<script>
import goodcar from './goodscar.vue'
export default {

    data(){
        return {
             goods:[],
             id:""
        }
    },
     created:async function(){
        let reslut = await this.$httpGet('/recommend?page=1&limit=10');
        console.log(reslut);
        this.goods=reslut.message
    
     },
     components:{
         goodcar
     },
     methods:{
         getid(data){
             this.id = data
             console.log(this.id);
             this.$router.push("/gooddetails/"+this.id)
         },
     }
}
</script>

<style lang="scss" scoped>
.tatol{
    display: flex;
    flex-flow: wrap;
    justify-content: space-between;
    align-content: space-around;
    padding: 0 0.3rem;
    background-color: #f7f8fa;
}

</style>